package com.penghk.hangzhouhouseprice.task;

import com.penghk.hangzhouhouseprice.service.GanjiNewHousePriceService;
import com.penghk.hangzhouhouseprice.service.LianjiaAreaPriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class HousePriceTask {

    @Autowired
    GanjiNewHousePriceService ganjiHousePriceService;

    @Autowired
    LianjiaAreaPriceService lianjiaAreaPriceService;

    /**
     * 每周日12点发送
     */
    @Scheduled(cron = "0 0 12 * * 1")
    public void getGanjiPrice() {
        ganjiHousePriceService.getHousePrice();
        lianjiaAreaPriceService.getHousePrice();
    }


    /**
     * 每一个小时发送
     */
    @Scheduled(cron = "0 0 0/1 * * *")
    public void getTestPrice() {
        lianjiaAreaPriceService.getHousePrice();
    }

}
